package com.application.Custom;

import java.util.ArrayList;
import java.util.List;

import com.application.Activity.R;
import com.application.DTO.RoleDTO;

import ReadWriteXML.CMember;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class ListUserAdapter extends ArrayAdapter<CMember>{
	private  Context context;
	private  ArrayList<CMember> arrayListMember;
	int _resource;

	public ListUserAdapter(Context context, int textViewResourceId,
			ArrayList<CMember> objects) {
		super(context, textViewResourceId, objects);
		this.arrayListMember = objects;
		this.context = context;
		this._resource = textViewResourceId;
	}

	@Override
	public View getView (int position, View convertView, ViewGroup parent){
		final CMember lvMember = arrayListMember.get(position);
		View RoleView = convertView;
		//Kiem tra workView neu null thi tao moi
		if(RoleView == null){
			LayoutInflater lInflater = (LayoutInflater) this.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);;
			RoleView = lInflater.inflate(R.layout.list_rolelist,null, true);
		}
		if(lvMember != null){
			TextView roleText = (TextView) RoleView.findViewById(R.id.txt_VaiTro);
			roleText.setText(lvMember.get_userName());
		}
		return RoleView;
	}
}
